<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" errorPage="error.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  	<title>忘记密码</title>	
    <jsp:include page="./include.jsp" flush="true"/>
	<script type="text/javascript">
		function lookforPsw(){
			var name = document.getElementById("user_id").value;
			var email = document.getElementById("user_email").value;
			var yzm1 = document.getElementById("checkCode").value.toUpperCase();
			var yzm2 = document.getElementById("authcode").value.toUpperCase();
			if(name == null || name == ""){
				show('登录名不能为空！');
				return false;
			}
			if(email == null || email == ""){
				show('邮箱不能为空！');
				return false;
			}
			if(yzm1 != yzm2){
				show('验证码输入不正确！');
				createCode();
				return false;
			}
			$.post('L02!checkForgetPsw',{
				user_id:name,
				user_email:email
			},function(message){
				if(message.returnFlag == 'N'){
					alert(message.returnMsg);
					createCode();
					return false;
				}else if(message.returnFlag == 'Y'){
					$.post('L02!sendPsw',{
						addressTo:message.returnMsg,
						user_id:name
					},function(message){
						show(message.returnMsg);
					});
				}
			});
		}
	</script>
  </head>
  
  <body onload="createCode();">
    <form id="form1" name="form1" method="post">
	    <table border="0" cellpadding="1" >
	    	<tr bordercolor="black">
	    		<td align="center" >登录名</td>
	    		<td align="center" >
	    			<input class="easyui-validatebox" type="text" id="user_id" name="user_id">
	    		</td>
	    	</tr>
	    	<tr bordercolor="black">
	    		<td align="center" >注册邮箱</td>
	    		<td align="center" >
	    			<input class="easyui-validatebox" type="text" id="user_email" name="user_email"/>
	    		</td>
	    	</tr>
	    	<tr>
	    		<td>
	    			<input type="button" id="checkCode" class="code" style="width: 55px" onclick="createCode();"/>
	    		</td>
	    		<td align="center">
	    			<input class="easyui-validatebox" type="text" id="authcode"/>
	    		</td>
	    	</tr>
	    	<tr bordercolor="black">
	    		<td align="center" >
		    		<a href="./login.jsp" >返回登录</a>
	    		</td>
	    		<td align="center" >
	    			<a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#form1').form('clear');">重置</a>
	    			&nbsp;&nbsp;
	    			<a href="javascript:void(0)" class="easyui-linkbutton" onclick="lookforPsw()">找回密码</a>
	    		</td>
	    	</tr>
	    </table>
    </form>
    
  </body>
</html>
